﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BookExchange.ODataService;

namespace BookExchange.ViewModel
{
    public class MemberViewModel
    {
        public void InitEmptyValues()
        {
            this.MemberCode = -1;
            this.Email = string.Empty;
            this.DisplayName = string.Empty;
            this.RoleCode = -1;
        }

        public MemberViewModel(Member member)
        {
            if (member == null)
            {
                InitEmptyValues();

                return;
            }

            this.MemberCode = member.MemberCode;
            this.Email = member.Email;
            this.DisplayName = member.DisplayName;
            this.RoleCode = member.RoleCode == null ? 0 : member.RoleCode.Value;
        }

        public int MemberCode { get; set; }
        public string Email { get; set; }
        public string DisplayName { get; set; }
        public int RoleCode { get; set; }
    }
}